//
//  BackWebViewController.m
//  GoShops
//
//  Created by zcj on 15-12-3.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "BackWebViewController.h"
#import "Grouble.h"

@interface BackWebViewController ()<UIWebViewDelegate>

@end

@implementation BackWebViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setWebViews];
    // Do any additional setup after loading the view.
}
- (void)setWebViews
{
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    self.webView.delegate = self;
    self.webView.scalesPageToFit = YES;
    [self.view addSubview:self.webView];
    NSURLRequest *requestUrl = [NSURLRequest requestWithURL:[NSURL URLWithString:self.urlStr]];
    [self.webView loadRequest:requestUrl];
    if ([self.urlStr isEqualToString:@"http://m.z.jd.com/new.html"]) {
        self.title = @"京东商城";
    }else{
        self.title = @"消费者保障服务中心";
    }
    
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [MBProgressHUD showError:@"我靠，出bug了"];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [MBProgressHUD hideHUD];
    NSString *theTitle=[webView stringByEvaluatingJavaScriptFromString:@"document.title"];
    ZCJLog(@"%@",theTitle);
    
    
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [MBProgressHUD showMessage:@"正在加载"];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
